<?php

$handle = opendir('./auto_parts/'); //当前目录
while (false !== ($file = readdir($handle))) { //遍历该php文件所在目录
	list($filesname,$kzm)=explode(".",$file);//获取扩展名
	if($kzm=="jpg" or $kzm=="JPG" or $kzm=="png" or $kzm=="PNG") { //文件过滤
		if (!is_dir('./'.$file)) { //文件夹过滤
			$pictures[]=$file;//把符合条件的文件名存入数组
			$i++;//记录图片总张数
		}
	}
}

//$pictures=array('citroen.jpg','honda.jpg','buick.jpg','audi.jpg','mg.jpg','benz.jpg','mitsubishi.jpg');
shuffle($pictures);

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bob's Auto Parts</title>
</head>

<body>


<div align="center">
<h1>Bob's Auto Parts</h1>
<table>
<tr>
<?php 

	for($i=0;$i<3;$i++){
		echo "<td align=\"center\"><img  width=\"240\" height=\"320\" src=\"auto_parts/";
	
		
		
		
		echo $pictures[$i];
		echo "\"/></td>";
		
		
	}
?>
</tr>
</table>
</div>
</body>
</html>